Souvlaki

A cross-platform library for handling OS media controls and metadata. One abstraction for Linux, MacOS and Windows.
Supported platforms
- Linux (via MPRIS)
- MacOS
- Windows
Windows
- Update metadata:

- Play and pause polling.

Linux
-
GNOME:

-
playerctl:
# In one shell
$ cd souvlaki
$ cargo run --example example
# In another shell
$ playerctl metadata
my_player xesam:artist Slowdive
my_player xesam:album Souvlaki
my_player mpris:artUrl https://c.pxhere.com/photos/34/c1/souvlaki_authentic_greek_greek_food_mezes-497780.jpg!d
my_player mpris:trackid '/'
my_player mpris:length 290000000
my_player xesam:title When The Sun Hits
MacOS
- Control Center:

- Now Playing:

Usage
The main struct is MediaControls. In order to create this struct you need a PlatformConfig. This struct contains all of the platform-specific requirements for spawning media controls. Here are the differences between the platforms:
- MacOS: No config needed, but requires a window to be open (#23)
- Linux:
dbus_name: The way your player will appear on D-Bus. It should follow the D-Bus specification.display_name: This could be however you want. It's the name that will be shown to the users.
- Windows:
hwnd: In this platform, a window needs to be opened to create media controls. The argument required is anHWND, a value of type*mut c_void. This value can be extracted when you open a window in your program, for example using theraw_window_handlein winit.
Example
use ;
Thanks 💗
- To jpochyla for being a contributor to library architecture and the sole developer of MacOS support.